﻿using System;
using System.Collections.Generic;
using System.Linq;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Audio;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.GamerServices;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Media;
using Microsoft.Xna.Framework.Net;
using Microsoft.Xna.Framework.Storage;

namespace Sublimation
{
    public class WorldProperties
    {
        protected Game game;
        public Game Game
        {
            get { return this.game; }
        }

        protected GameMap map;
        public GameMap Map
        {
            get { return this.map; }
            set { this.map = value; }
        }

        public static int MAX_PLAYERS = 4;
        protected int playerCount;
        public int PlayerCount
        {
            get { return playerCount; }
            set { playerCount = Math.Max(value, MAX_PLAYERS); }
        }

        protected Player[] players;
        public Player[] Players
        {
            get { return this.players; }
            set { this.players = value; }
        }

        public static int MAX_ENEMIES = 100;
        protected EnemyUnit[] enemies;
        public EnemyUnit[] Enemies
        {
            get { return this.enemies; }
            set { enemies = value; }
        }

        public Rectangle WorldBounds()
        {
            return this.map.WorldBounds;
        }

        public void GeneratePlayers()
        {
            Players = new Player[PlayerCount];
            for (int i = 0; i < PlayerCount; i++)
            {
                Players[i] = new Player(Game);
            }
        }

        public void StartGame()
        {
            GeneratePlayers();
        }

        public WorldProperties(Game game)
        {
            this.game = game;
            this.Enemies = new EnemyUnit[MAX_ENEMIES];
            PlayerCount = 1; // just a default to make sure.. not really necessary
        }
    }
}
